/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.impl;

import java.util.Collection;
import ms.jasim.model.Actor;
import ms.jasim.model.Dependency;
import ms.jasim.model.Goal;
import ms.jasim.model.ModelPackage;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Dependency</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ms.jasim.model.impl.DependencyImpl#getTargetActor <em>Target Actor</em>}</li>
 *   <li>{@link ms.jasim.model.impl.DependencyImpl#getGoal <em>Goal</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DependencyImpl extends ModelObjectImpl implements Dependency {
	/**
	 * The cached value of the '{@link #getTargetActor() <em>Target Actor</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTargetActor()
	 * @generated
	 * @ordered
	 */
	protected EList<Actor> targetActor;

	/**
	 * The cached value of the '{@link #getGoal() <em>Goal</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGoal()
	 * @generated
	 * @ordered
	 */
	protected EList<Goal> goal;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DependencyImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.DEPENDENCY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Actor> getTargetActor() {
		if (targetActor == null) {
			targetActor = new EObjectResolvingEList<Actor>(Actor.class, this, ModelPackage.DEPENDENCY__TARGET_ACTOR);
		}
		return targetActor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Goal> getGoal() {
		if (goal == null) {
			goal = new EObjectResolvingEList<Goal>(Goal.class, this, ModelPackage.DEPENDENCY__GOAL);
		}
		return goal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.DEPENDENCY__TARGET_ACTOR:
				return getTargetActor();
			case ModelPackage.DEPENDENCY__GOAL:
				return getGoal();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.DEPENDENCY__TARGET_ACTOR:
				getTargetActor().clear();
				getTargetActor().addAll((Collection<? extends Actor>)newValue);
				return;
			case ModelPackage.DEPENDENCY__GOAL:
				getGoal().clear();
				getGoal().addAll((Collection<? extends Goal>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.DEPENDENCY__TARGET_ACTOR:
				getTargetActor().clear();
				return;
			case ModelPackage.DEPENDENCY__GOAL:
				getGoal().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.DEPENDENCY__TARGET_ACTOR:
				return targetActor != null && !targetActor.isEmpty();
			case ModelPackage.DEPENDENCY__GOAL:
				return goal != null && !goal.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //DependencyImpl
